#[cfg(test)]
mod tests {
    use std::fmt::{Debug, Display};

    // 有点类似其他语言的implements ... 需要实现多个特性
    fn compare_prints<T: Debug + Display>(t: &T) {
        println!("Debug: `{:?}`", t);
        println!("Display: `{}`", t);
    }

    fn compare_types<T: Debug, U: Debug>(t: &T, u: &U) {
        println!("t: `{:?}", t);
        println!("u: `{:?}", u);
    }

    #[test]
    fn test() {
        let string = "words";
        let array = [1, 2, 3];
        let vec = vec![1, 2, 3];

        compare_prints(&string);
        //compare_prints(&array);
        // 试一试 ^ 将此行注释去掉。

        compare_types(&array, &vec);
    }
}
